@zonos/elements 1.3.165 → 1.3.166

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/cjs/index.cjs.js +7 -7
  2. package/dist/cjs/zonos-cart-items_13.cjs.entry.js +36 -23
  3. package/dist/cjs/zonos-checkout.cjs.entry.js +6 -3
  4. package/dist/cjs/zonos-controller.cjs.entry.js +3 -2
  5. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +36 -23
  6. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +6 -3
  7. package/dist/collection/components/main/zonos-controller.js +3 -2
  8. package/dist/esm/index.js +7 -7
  9. package/dist/esm/zonos-cart-items_13.entry.js +36 -23
  10. package/dist/esm/zonos-checkout.entry.js +6 -3
  11. package/dist/esm/zonos-controller.entry.js +3 -2
  12. package/dist/esm-es5/index.js +1 -1
  13. package/dist/esm-es5/zonos-cart-items_13.entry.js +1 -1
  14. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  15. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  16. package/dist/scripts/index.js +1 -1
  17. package/dist/scripts/loadZonos.js +1 -1
  18. package/dist/scripts/zonos.js +1 -1
  19. package/dist/types/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.d.ts +1 -0
  20. package/dist/zonos-elements/index.esm.js +1 -1
  21. package/dist/zonos-elements/{p-6e864533.entry.js → p-0150bb1e.entry.js} +1 -1
  22. package/dist/zonos-elements/p-4508c22b.entry.js +1 -0
  23. package/dist/zonos-elements/p-46f6e5e9.system.js +1 -1
  24. package/dist/zonos-elements/p-68fd23f8.entry.js +1 -0
  25. package/dist/zonos-elements/{p-1c850630.system.entry.js → p-82a0fcb7.system.entry.js} +1 -1
  26. package/dist/zonos-elements/p-c3ec1618.system.entry.js +1 -0
  27. package/dist/zonos-elements/{p-735d4097.system.entry.js → p-d0adc1b5.system.entry.js} +1 -1
  28. package/dist/zonos-elements/{p-3c865c53.system.js → p-ff2e5330.system.js} +1 -1
  29. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  30. package/package.json +1 -1
  31. package/dist/zonos-elements/p-18d23528.entry.js +0 -1
  32. package/dist/zonos-elements/p-9d53988d.system.entry.js +0 -1
  33. package/dist/zonos-elements/p-f9c2ff4c.entry.js +0 -1
@@ -129,7 +129,7 @@ const getZonosQaUrl = () => {
129
129
  return null;
130
130
  }
131
131
  const qaUrl = extractZonosQaUrl(window.location.href);
132
- const cdnUrl = "https://v1.3.165.js.zonos.com";
132
+ const cdnUrl = "https://v1.3.166.js.zonos.com";
133
133
  // when the qaUrl is not set and the built URL is from the test domain, use the test domain for testing
134
134
  if (!qaUrl &&
135
135
  (cdnUrl.includes('test.') ||
@@ -313,10 +313,10 @@ const zonosLoadUrl = (() => {
313
313
  }
314
314
  return null;
315
315
  })();
316
- const ZONOS_URL = "https://v1.3.165.js.zonos.com";
317
- const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.165";
318
- const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.165";
319
- const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.165";
316
+ const ZONOS_URL = "https://v1.3.166.js.zonos.com";
317
+ const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.166";
318
+ const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.166";
319
+ const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.166";
320
320
  const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
321
321
  const GOOGLE_FONT_REGEX = /^https:\/\/fonts\.googleapis\.com/;
322
322
  class Zonos {
@@ -330,7 +330,7 @@ Zonos.zonosConversionTest = typeof window !== 'undefined' &&
330
330
  !!window.location.search.match(/\?.*(&*)zonosConversionTest/);
331
331
  Zonos._paypalMockResponse = null;
332
332
  Zonos.isBigCommerce = false;
333
- Zonos.releaseDate = "1740583818267";
333
+ Zonos.releaseDate = "1741125121075";
334
334
  Zonos.isLegacyCheckout = false;
335
335
  Zonos.domain = typeof window !== 'undefined'
336
336
  ? // domain that embeds the iframe
@@ -346,7 +346,7 @@ Zonos.showBaseForeign = typeof window !== 'undefined' &&
346
346
  Zonos.isNpm = true;
347
347
  Zonos.zonosQaUrl = null;
348
348
  Zonos.zonosQaUrlApi = null;
349
- Zonos.version = `v${"1.3.165"}`;
349
+ Zonos.version = `v${"1.3.166"}`;
350
350
  Zonos.modeAlerted = false;
351
351
  Zonos.cartData = null;
352
352
  Zonos.paypal = null;
@@ -1328,8 +1328,29 @@ const ZonosCheckoutFinish = class {
1328
1328
  this.shouldRenderCloseButtonForRedirectBehavior = () => {
1329
1329
  return this.isRedirectBehavior() || this.notificationType === 'error';
1330
1330
  };
1331
+ this.redirectToMerchantSuccessPage = () => {
1332
+ var _a, _b, _c, _d;
1333
+ const settingsRedirectUrl = cart.cartStore.externalConfirmationPageURL ||
1334
+ zonosStore.zonosStore.checkoutSettings.successRedirectUrl;
1335
+ const redirectUrl = settingsRedirectUrl;
1336
+ const queryParams = new URLSearchParams();
1337
+ const orderId = (_a = this.order) === null || _a === void 0 ? void 0 : _a.id;
1338
+ const legacyOrderNumber = ((_d = (_c = (_b = this.order) === null || _b === void 0 ? void 0 : _b.references) === null || _c === void 0 ? void 0 : _c.find(entry => (entry === null || entry === void 0 ? void 0 : entry.key) === 'zonosOrderNumber')) === null || _d === void 0 ? void 0 : _d.value) || null;
1339
+ if (orderId) {
1340
+ queryParams.set('zOrderNumber', orderId);
1341
+ }
1342
+ if (legacyOrderNumber) {
1343
+ queryParams.set('orderId', legacyOrderNumber);
1344
+ }
1345
+ const queryString = queryParams.toString();
1346
+ const hasQueryString = redirectUrl.includes('?');
1347
+ this.isWaitingToRedirect = true;
1348
+ this.redirectToUrl(queryString
1349
+ ? // Some url already has query string, so we need to append the query string with '&' instead of '?'
1350
+ `${redirectUrl}${hasQueryString ? '&' : '?'}${queryString}`
1351
+ : redirectUrl);
1352
+ };
1331
1353
  this.handleSuccessBehavior = async () => {
1332
- var _a, _b;
1333
1354
  /**
1334
1355
  * Save placed order info so we can show order info if they try to place the order again
1335
1356
  */
@@ -1339,9 +1360,6 @@ const ZonosCheckoutFinish = class {
1339
1360
  // If the merchant wants to redirect to a different page
1340
1361
  case successBehavior === 'REDIRECT_TO_SUCCESS_PAGE':
1341
1362
  case !!cart.cartStore.externalConfirmationPageURL: {
1342
- const settingsRedirectUrl = cart.cartStore.externalConfirmationPageURL ||
1343
- zonosStore.zonosStore.checkoutSettings.successRedirectUrl;
1344
- const redirectUrl = settingsRedirectUrl;
1345
1363
  // use different default notification message if we are redirecting to a different page
1346
1364
  this.notificationTitle = cart.translate('Order complete!');
1347
1365
  this.notificationMessages = [
@@ -1364,20 +1382,7 @@ const ZonosCheckoutFinish = class {
1364
1382
  return;
1365
1383
  }
1366
1384
  this.isWaitingToRedirect = false;
1367
- const legacyOrderNumber = ((_b = (_a = this.order.references) === null || _a === void 0 ? void 0 : _a.find(entry => (entry === null || entry === void 0 ? void 0 : entry.key) === 'zonosOrderNumber')) === null || _b === void 0 ? void 0 : _b.value) || null;
1368
- const queryParams = new URLSearchParams();
1369
- if (this.order.id) {
1370
- queryParams.set('zOrderNumber', this.order.id);
1371
- }
1372
- if (legacyOrderNumber) {
1373
- queryParams.set('orderId', legacyOrderNumber);
1374
- }
1375
- const queryString = queryParams.toString();
1376
- const hasQueryString = redirectUrl.includes('?');
1377
- this.redirectToUrl(queryString
1378
- ? // Some url already has query string, so we need to append the query string with '&' instead of '?'
1379
- `${redirectUrl}${hasQueryString ? '&' : '?'}${queryString}`
1380
- : redirectUrl);
1385
+ this.redirectToMerchantSuccessPage();
1381
1386
  break;
1382
1387
  }
1383
1388
  case successBehavior === 'CLOSE_MODAL':
@@ -1627,17 +1632,25 @@ const ZonosCheckoutFinish = class {
1627
1632
  }
1628
1633
  render() {
1629
1634
  const isTestMode = handleFetch.getIsTestMode();
1630
- return (index.h(index.Host, { key: '83b2f5f6f12dff3ed43382c27d1ed438ba22170f', class: "zonos--checkout-finish zonos--elements", style: {
1635
+ return (index.h(index.Host, { key: 'afcb0314658af4d53e7d453415dd73fb01a8f162', class: "zonos--checkout-finish zonos--elements", style: {
1631
1636
  '--zonos--border-radius': getBorderRadius.getBorderRadius({
1632
1637
  overrideBorderStyle: this.borderRadius,
1633
1638
  }),
1634
- } }, !this.isLoading && (index.h("div", { key: 'caba612654a4895ba6ef43781ca21688c17e32ea', class: "zonos--finish-details" }, index.h("div", { key: 'd18c28b4993f28a2d509b2a9178fed7edfe5de3d', class: "zonos--group" }, this.notificationType === 'success' ? (index.h("zonos-icon", { "aria-label": "Order success", content: SuccessIcon, iconColor: 'blue-800', size: 50 })) : (index.h("zonos-icon", { "aria-label": "Order failed", content: RemoveIcon, iconColor: 'red-800', size: 50 })), index.h("zonos-text", { key: 'af4f9f2178e83d8079950ad44a6b228976e761bc', class: "zonos--title", type: "semiBoldSubheader" }, this.notificationTitle), index.h("zonos-text", { key: 'cc4934a9c86c02d00d381b1d8e3a457ebf4759e3', class: "zonos--subtitle", textColor: "gray-600" }, this.notificationMessages.map(message => (index.h(index.Fragment, null, message, index.h("br", null))))), this.shouldRenderCloseButtonForRedirectBehavior() && (index.h("zonos-button", { key: 'c0f448d9f8fc30d5757714a041b440c48ed8a972',
1639
+ } }, !this.isLoading && (index.h("div", { key: '99b7b6c9dd0e0545d770e4d9ed54207f5c13fdfd', class: "zonos--finish-details" }, index.h("div", { key: '11d249514d0eef2f8419e66b1070a20e745b84fd', class: "zonos--group" }, this.notificationType === 'success' ? (index.h("zonos-icon", { "aria-label": "Order success", content: SuccessIcon, iconColor: 'blue-800', size: 50 })) : (index.h("zonos-icon", { "aria-label": "Order failed", content: RemoveIcon, iconColor: 'red-800', size: 50 })), index.h("zonos-text", { key: 'c8f52780e8ea76b5951aa4ad3dfc87c19acbfd1d', class: "zonos--title", type: "semiBoldSubheader" }, this.notificationTitle), index.h("zonos-text", { key: '459d7c1a9bd6fd77cfda25e9500a89061874b58f', class: "zonos--subtitle", textColor: "gray-600" }, this.notificationMessages.map(message => (index.h(index.Fragment, null, message, index.h("br", null))))), this.shouldRenderCloseButtonForRedirectBehavior() && (index.h("zonos-button", { key: '4e34926ba96975ceff18016eb6bcad1906f1c773',
1635
1640
  // Only show loading spinner if it's not an error notification
1636
1641
  loading: this.isWaitingToRedirect &&
1637
- this.notificationType !== 'error', onClick: () => this.closeClickHandler(), size: "md", variant: "primary" }, cart.translate('Close'))), !window.Zonos.isLegacyCheckout &&
1638
- this.shouldRenderKeepShoppingButton() && (index.h("zonos-button", { key: '7cd94a0b56dbe608a4c3c9d12c9f9a4fc06c5ec3', onClick: () => this.closeClickHandler(), size: "md", variant: "primary" }, this.notificationActionText))), isTestMode &&
1642
+ this.notificationType !== 'error', onClick: () => {
1643
+ var _a;
1644
+ // Trigger the redirect action if order is ready when user clicks the close button
1645
+ if ((_a = this.order) === null || _a === void 0 ? void 0 : _a.id) {
1646
+ this.redirectToMerchantSuccessPage();
1647
+ return;
1648
+ }
1649
+ this.closeClickHandler();
1650
+ }, size: "md", variant: "primary" }, cart.translate('Close'))), !window.Zonos.isLegacyCheckout &&
1651
+ this.shouldRenderKeepShoppingButton() && (index.h("zonos-button", { key: '836907a2a325d615d897e5292f086bf9111226ae', onClick: () => this.closeClickHandler(), size: "md", variant: "primary" }, this.notificationActionText))), isTestMode &&
1639
1652
  cart.cartStore.step === 'finish' &&
1640
- this.notificationType === 'success' && (index.h("div", { key: 'ce7b437229ae19b2a2da2521f8603271ff35af96', class: "zonos--finish-button-wrapper" }, index.h("zonos-button", { key: '9ebb42bb862ffdf8c96c8e8d38174e149ced4d26', backgroundColor: "gray-0", buttonColor: "gray-1000", onClick: () => this.closeClickHandler(), size: "lg", variant: "outline" }, "New test cart"), index.h("zonos-button", { key: '6f9257ad1b3002a373b45ab498271825aea07a00', onClick: () => {
1653
+ this.notificationType === 'success' && (index.h("div", { key: 'ea1b4dd65f89d3eaec6391b6e440ae8ca20d5bdb', class: "zonos--finish-button-wrapper" }, index.h("zonos-button", { key: '350ee6b7fe58ff5e7a1584989e2df13ce5d243c6', backgroundColor: "gray-0", buttonColor: "gray-1000", onClick: () => this.closeClickHandler(), size: "lg", variant: "outline" }, "New test cart"), index.h("zonos-button", { key: 'd3578cef9a3f6cc69fff48ee412f7010d526c284', onClick: () => {
1641
1654
  const isZonosDashboard = window.location.hostname.includes('dashboard.zonos.com');
1642
1655
  this.redirectToUrl(isZonosDashboard
1643
1656
  ? '/orders/all'
@@ -591,7 +591,8 @@ const ZonosCheckout = class {
591
591
  this.placedOrderInfo = null;
592
592
  // Redirect to the vendor store url if this is legacy checkout
593
593
  if (this.isLegacyCheckout) {
594
- const storeBaseUrl = (_a = window.Zonos.cartData) === null || _a === void 0 ? void 0 : _a.storeBaseUrl;
594
+ const storeBaseUrl = ((_a = window.Zonos.cartData) === null || _a === void 0 ? void 0 : _a.storeBaseUrl) ||
595
+ zonosStore.zonosStore.onlineStoreSettings.url;
595
596
  if (!storeBaseUrl) {
596
597
  return;
597
598
  }
@@ -697,7 +698,8 @@ const ZonosCheckout = class {
697
698
  cartId: window.Zonos.cartId,
698
699
  checkoutSessionBody: cart.getCheckoutSessionBody(),
699
700
  href: window.location.href,
700
- storeBaseUrl: (_a = window.Zonos.cartData) === null || _a === void 0 ? void 0 : _a.storeBaseUrl,
701
+ storeBaseUrl: ((_a = window.Zonos.cartData) === null || _a === void 0 ? void 0 : _a.storeBaseUrl) ||
702
+ zonosStore.zonosStore.onlineStoreSettings.url,
701
703
  },
702
704
  });
703
705
  cart.cartStoreUpdateToErrorState({
@@ -1068,7 +1070,8 @@ const ZonosCheckout = class {
1068
1070
  cart.cartStoreReset();
1069
1071
  // redirect to vendor store url if this is legacy checkout.
1070
1072
  if (window.Zonos.isLegacyCheckout && window.Zonos.cartData) {
1071
- const storeBaseUrl = window.Zonos.cartData.storeBaseUrl;
1073
+ const storeBaseUrl = window.Zonos.cartData.storeBaseUrl ||
1074
+ zonosStore.zonosStore.onlineStoreSettings.url;
1072
1075
  if (window.parent) {
1073
1076
  window.parent.location.href = storeBaseUrl;
1074
1077
  }
@@ -307,7 +307,8 @@ const ZonosController = class {
307
307
  successBehavior: shouldOverrideSuccessBehavior
308
308
  ? 'ZONOS_SUCCESS_PAGE'
309
309
  : this.config.checkoutSettings.successBehavior, successRedirectUrl: shouldOverrideSuccessBehavior
310
- ? (_e = window.Zonos.cartData) === null || _e === void 0 ? void 0 : _e.storeBaseUrl
310
+ ? ((_e = window.Zonos.cartData) === null || _e === void 0 ? void 0 : _e.storeBaseUrl) ||
311
+ (json === null || json === void 0 ? void 0 : json.onlineStoreSettings.url)
311
312
  : this.config.checkoutSettings.successRedirectUrl
312
313
  }) : undefined });
313
314
  // load default setting if failed to load user settings
@@ -399,7 +400,7 @@ const ZonosController = class {
399
400
  zonosStore.zonosStore.organizationName = organizationName;
400
401
  }
401
402
  render() {
402
- return index.h(index.Host, { key: 'd5d6c9e8984b321893b92612620a16f3f43d81fa', class: "zonos--elements" });
403
+ return index.h(index.Host, { key: '14d142f73eae70c229b638ef298e20c9c7c5713d', class: "zonos--elements" });
403
404
  }
404
405
  };
405
406
  ZonosController.style = ZonosControllerStyle0;
@@ -73,8 +73,29 @@ export class ZonosCheckoutFinish {
73
73
  this.shouldRenderCloseButtonForRedirectBehavior = () => {
74
74
  return this.isRedirectBehavior() || this.notificationType === 'error';
75
75
  };
76
+ this.redirectToMerchantSuccessPage = () => {
77
+ var _a, _b, _c, _d;
78
+ const settingsRedirectUrl = cartStore.externalConfirmationPageURL ||
79
+ zonosStore.checkoutSettings.successRedirectUrl;
80
+ const redirectUrl = settingsRedirectUrl;
81
+ const queryParams = new URLSearchParams();
82
+ const orderId = (_a = this.order) === null || _a === void 0 ? void 0 : _a.id;
83
+ const legacyOrderNumber = ((_d = (_c = (_b = this.order) === null || _b === void 0 ? void 0 : _b.references) === null || _c === void 0 ? void 0 : _c.find(entry => (entry === null || entry === void 0 ? void 0 : entry.key) === 'zonosOrderNumber')) === null || _d === void 0 ? void 0 : _d.value) || null;
84
+ if (orderId) {
85
+ queryParams.set('zOrderNumber', orderId);
86
+ }
87
+ if (legacyOrderNumber) {
88
+ queryParams.set('orderId', legacyOrderNumber);
89
+ }
90
+ const queryString = queryParams.toString();
91
+ const hasQueryString = redirectUrl.includes('?');
92
+ this.isWaitingToRedirect = true;
93
+ this.redirectToUrl(queryString
94
+ ? // Some url already has query string, so we need to append the query string with '&' instead of '?'
95
+ `${redirectUrl}${hasQueryString ? '&' : '?'}${queryString}`
96
+ : redirectUrl);
97
+ };
76
98
  this.handleSuccessBehavior = async () => {
77
- var _a, _b;
78
99
  /**
79
100
  * Save placed order info so we can show order info if they try to place the order again
80
101
  */
@@ -84,9 +105,6 @@ export class ZonosCheckoutFinish {
84
105
  // If the merchant wants to redirect to a different page
85
106
  case successBehavior === 'REDIRECT_TO_SUCCESS_PAGE':
86
107
  case !!cartStore.externalConfirmationPageURL: {
87
- const settingsRedirectUrl = cartStore.externalConfirmationPageURL ||
88
- zonosStore.checkoutSettings.successRedirectUrl;
89
- const redirectUrl = settingsRedirectUrl;
90
108
  // use different default notification message if we are redirecting to a different page
91
109
  this.notificationTitle = translate('Order complete!');
92
110
  this.notificationMessages = [
@@ -109,20 +127,7 @@ export class ZonosCheckoutFinish {
109
127
  return;
110
128
  }
111
129
  this.isWaitingToRedirect = false;
112
- const legacyOrderNumber = ((_b = (_a = this.order.references) === null || _a === void 0 ? void 0 : _a.find(entry => (entry === null || entry === void 0 ? void 0 : entry.key) === 'zonosOrderNumber')) === null || _b === void 0 ? void 0 : _b.value) || null;
113
- const queryParams = new URLSearchParams();
114
- if (this.order.id) {
115
- queryParams.set('zOrderNumber', this.order.id);
116
- }
117
- if (legacyOrderNumber) {
118
- queryParams.set('orderId', legacyOrderNumber);
119
- }
120
- const queryString = queryParams.toString();
121
- const hasQueryString = redirectUrl.includes('?');
122
- this.redirectToUrl(queryString
123
- ? // Some url already has query string, so we need to append the query string with '&' instead of '?'
124
- `${redirectUrl}${hasQueryString ? '&' : '?'}${queryString}`
125
- : redirectUrl);
130
+ this.redirectToMerchantSuccessPage();
126
131
  break;
127
132
  }
128
133
  case successBehavior === 'CLOSE_MODAL':
@@ -372,17 +377,25 @@ export class ZonosCheckoutFinish {
372
377
  }
373
378
  render() {
374
379
  const isTestMode = getIsTestMode();
375
- return (h(Host, { key: '83b2f5f6f12dff3ed43382c27d1ed438ba22170f', class: "zonos--checkout-finish zonos--elements", style: {
380
+ return (h(Host, { key: 'afcb0314658af4d53e7d453415dd73fb01a8f162', class: "zonos--checkout-finish zonos--elements", style: {
376
381
  '--zonos--border-radius': getBorderRadius({
377
382
  overrideBorderStyle: this.borderRadius,
378
383
  }),
379
- } }, !this.isLoading && (h("div", { key: 'caba612654a4895ba6ef43781ca21688c17e32ea', class: "zonos--finish-details" }, h("div", { key: 'd18c28b4993f28a2d509b2a9178fed7edfe5de3d', class: "zonos--group" }, this.notificationType === 'success' ? (h("zonos-icon", { "aria-label": "Order success", content: SuccessIcon, iconColor: 'blue-800', size: 50 })) : (h("zonos-icon", { "aria-label": "Order failed", content: RemoveIcon, iconColor: 'red-800', size: 50 })), h("zonos-text", { key: 'af4f9f2178e83d8079950ad44a6b228976e761bc', class: "zonos--title", type: "semiBoldSubheader" }, this.notificationTitle), h("zonos-text", { key: 'cc4934a9c86c02d00d381b1d8e3a457ebf4759e3', class: "zonos--subtitle", textColor: "gray-600" }, this.notificationMessages.map(message => (h(Fragment, null, message, h("br", null))))), this.shouldRenderCloseButtonForRedirectBehavior() && (h("zonos-button", { key: 'c0f448d9f8fc30d5757714a041b440c48ed8a972',
384
+ } }, !this.isLoading && (h("div", { key: '99b7b6c9dd0e0545d770e4d9ed54207f5c13fdfd', class: "zonos--finish-details" }, h("div", { key: '11d249514d0eef2f8419e66b1070a20e745b84fd', class: "zonos--group" }, this.notificationType === 'success' ? (h("zonos-icon", { "aria-label": "Order success", content: SuccessIcon, iconColor: 'blue-800', size: 50 })) : (h("zonos-icon", { "aria-label": "Order failed", content: RemoveIcon, iconColor: 'red-800', size: 50 })), h("zonos-text", { key: 'c8f52780e8ea76b5951aa4ad3dfc87c19acbfd1d', class: "zonos--title", type: "semiBoldSubheader" }, this.notificationTitle), h("zonos-text", { key: '459d7c1a9bd6fd77cfda25e9500a89061874b58f', class: "zonos--subtitle", textColor: "gray-600" }, this.notificationMessages.map(message => (h(Fragment, null, message, h("br", null))))), this.shouldRenderCloseButtonForRedirectBehavior() && (h("zonos-button", { key: '4e34926ba96975ceff18016eb6bcad1906f1c773',
380
385
  // Only show loading spinner if it's not an error notification
381
386
  loading: this.isWaitingToRedirect &&
382
- this.notificationType !== 'error', onClick: () => this.closeClickHandler(), size: "md", variant: "primary" }, translate('Close'))), !window.Zonos.isLegacyCheckout &&
383
- this.shouldRenderKeepShoppingButton() && (h("zonos-button", { key: '7cd94a0b56dbe608a4c3c9d12c9f9a4fc06c5ec3', onClick: () => this.closeClickHandler(), size: "md", variant: "primary" }, this.notificationActionText))), isTestMode &&
387
+ this.notificationType !== 'error', onClick: () => {
388
+ var _a;
389
+ // Trigger the redirect action if order is ready when user clicks the close button
390
+ if ((_a = this.order) === null || _a === void 0 ? void 0 : _a.id) {
391
+ this.redirectToMerchantSuccessPage();
392
+ return;
393
+ }
394
+ this.closeClickHandler();
395
+ }, size: "md", variant: "primary" }, translate('Close'))), !window.Zonos.isLegacyCheckout &&
396
+ this.shouldRenderKeepShoppingButton() && (h("zonos-button", { key: '836907a2a325d615d897e5292f086bf9111226ae', onClick: () => this.closeClickHandler(), size: "md", variant: "primary" }, this.notificationActionText))), isTestMode &&
384
397
  cartStore.step === 'finish' &&
385
- this.notificationType === 'success' && (h("div", { key: 'ce7b437229ae19b2a2da2521f8603271ff35af96', class: "zonos--finish-button-wrapper" }, h("zonos-button", { key: '9ebb42bb862ffdf8c96c8e8d38174e149ced4d26', backgroundColor: "gray-0", buttonColor: "gray-1000", onClick: () => this.closeClickHandler(), size: "lg", variant: "outline" }, "New test cart"), h("zonos-button", { key: '6f9257ad1b3002a373b45ab498271825aea07a00', onClick: () => {
398
+ this.notificationType === 'success' && (h("div", { key: 'ea1b4dd65f89d3eaec6391b6e440ae8ca20d5bdb', class: "zonos--finish-button-wrapper" }, h("zonos-button", { key: '350ee6b7fe58ff5e7a1584989e2df13ce5d243c6', backgroundColor: "gray-0", buttonColor: "gray-1000", onClick: () => this.closeClickHandler(), size: "lg", variant: "outline" }, "New test cart"), h("zonos-button", { key: 'd3578cef9a3f6cc69fff48ee412f7010d526c284', onClick: () => {
386
399
  const isZonosDashboard = window.location.hostname.includes('dashboard.zonos.com');
387
400
  this.redirectToUrl(isZonosDashboard
388
401
  ? '/orders/all'
@@ -382,7 +382,8 @@ export class ZonosCheckout {
382
382
  this.placedOrderInfo = null;
383
383
  // Redirect to the vendor store url if this is legacy checkout
384
384
  if (this.isLegacyCheckout) {
385
- const storeBaseUrl = (_a = window.Zonos.cartData) === null || _a === void 0 ? void 0 : _a.storeBaseUrl;
385
+ const storeBaseUrl = ((_a = window.Zonos.cartData) === null || _a === void 0 ? void 0 : _a.storeBaseUrl) ||
386
+ zonosStore.onlineStoreSettings.url;
386
387
  if (!storeBaseUrl) {
387
388
  return;
388
389
  }
@@ -488,7 +489,8 @@ export class ZonosCheckout {
488
489
  cartId: window.Zonos.cartId,
489
490
  checkoutSessionBody: getCheckoutSessionBody(),
490
491
  href: window.location.href,
491
- storeBaseUrl: (_a = window.Zonos.cartData) === null || _a === void 0 ? void 0 : _a.storeBaseUrl,
492
+ storeBaseUrl: ((_a = window.Zonos.cartData) === null || _a === void 0 ? void 0 : _a.storeBaseUrl) ||
493
+ zonosStore.onlineStoreSettings.url,
492
494
  },
493
495
  });
494
496
  cartStoreUpdateToErrorState({
@@ -859,7 +861,8 @@ export class ZonosCheckout {
859
861
  cartStoreReset();
860
862
  // redirect to vendor store url if this is legacy checkout.
861
863
  if (window.Zonos.isLegacyCheckout && window.Zonos.cartData) {
862
- const storeBaseUrl = window.Zonos.cartData.storeBaseUrl;
864
+ const storeBaseUrl = window.Zonos.cartData.storeBaseUrl ||
865
+ zonosStore.onlineStoreSettings.url;
863
866
  if (window.parent) {
864
867
  window.parent.location.href = storeBaseUrl;
865
868
  }
@@ -156,7 +156,8 @@ export class ZonosController {
156
156
  successBehavior: shouldOverrideSuccessBehavior
157
157
  ? 'ZONOS_SUCCESS_PAGE'
158
158
  : this.config.checkoutSettings.successBehavior, successRedirectUrl: shouldOverrideSuccessBehavior
159
- ? (_e = window.Zonos.cartData) === null || _e === void 0 ? void 0 : _e.storeBaseUrl
159
+ ? ((_e = window.Zonos.cartData) === null || _e === void 0 ? void 0 : _e.storeBaseUrl) ||
160
+ (json === null || json === void 0 ? void 0 : json.onlineStoreSettings.url)
160
161
  : this.config.checkoutSettings.successRedirectUrl
161
162
  }) : undefined });
162
163
  // load default setting if failed to load user settings
@@ -248,7 +249,7 @@ export class ZonosController {
248
249
  zonosStore.organizationName = organizationName;
249
250
  }
250
251
  render() {
251
- return h(Host, { key: 'd5d6c9e8984b321893b92612620a16f3f43d81fa', class: "zonos--elements" });
252
+ return h(Host, { key: '14d142f73eae70c229b638ef298e20c9c7c5713d', class: "zonos--elements" });
252
253
  }
253
254
  static get is() { return "zonos-controller"; }
254
255
  static get encapsulation() { return "shadow"; }
package/dist/esm/index.js CHANGED
@@ -126,7 +126,7 @@ const getZonosQaUrl = () => {
126
126
  return null;
127
127
  }
128
128
  const qaUrl = extractZonosQaUrl(window.location.href);
129
- const cdnUrl = "https://v1.3.165.js.zonos.com";
129
+ const cdnUrl = "https://v1.3.166.js.zonos.com";
130
130
  // when the qaUrl is not set and the built URL is from the test domain, use the test domain for testing
131
131
  if (!qaUrl &&
132
132
  (cdnUrl.includes('test.') ||
@@ -310,10 +310,10 @@ const zonosLoadUrl = (() => {
310
310
  }
311
311
  return null;
312
312
  })();
313
- const ZONOS_URL = "https://v1.3.165.js.zonos.com";
314
- const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.165";
315
- const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.165";
316
- const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.165";
313
+ const ZONOS_URL = "https://v1.3.166.js.zonos.com";
314
+ const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.166";
315
+ const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.166";
316
+ const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.166";
317
317
  const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
318
318
  const GOOGLE_FONT_REGEX = /^https:\/\/fonts\.googleapis\.com/;
319
319
  class Zonos {
@@ -327,7 +327,7 @@ Zonos.zonosConversionTest = typeof window !== 'undefined' &&
327
327
  !!window.location.search.match(/\?.*(&*)zonosConversionTest/);
328
328
  Zonos._paypalMockResponse = null;
329
329
  Zonos.isBigCommerce = false;
330
- Zonos.releaseDate = "1740583818267";
330
+ Zonos.releaseDate = "1741125121075";
331
331
  Zonos.isLegacyCheckout = false;
332
332
  Zonos.domain = typeof window !== 'undefined'
333
333
  ? // domain that embeds the iframe
@@ -343,7 +343,7 @@ Zonos.showBaseForeign = typeof window !== 'undefined' &&
343
343
  Zonos.isNpm = true;
344
344
  Zonos.zonosQaUrl = null;
345
345
  Zonos.zonosQaUrlApi = null;
346
- Zonos.version = `v${"1.3.165"}`;
346
+ Zonos.version = `v${"1.3.166"}`;
347
347
  Zonos.modeAlerted = false;
348
348
  Zonos.cartData = null;
349
349
  Zonos.paypal = null;
@@ -1324,8 +1324,29 @@ const ZonosCheckoutFinish = class {
1324
1324
  this.shouldRenderCloseButtonForRedirectBehavior = () => {
1325
1325
  return this.isRedirectBehavior() || this.notificationType === 'error';
1326
1326
  };
1327
+ this.redirectToMerchantSuccessPage = () => {
1328
+ var _a, _b, _c, _d;
1329
+ const settingsRedirectUrl = cartStore.externalConfirmationPageURL ||
1330
+ zonosStore.checkoutSettings.successRedirectUrl;
1331
+ const redirectUrl = settingsRedirectUrl;
1332
+ const queryParams = new URLSearchParams();
1333
+ const orderId = (_a = this.order) === null || _a === void 0 ? void 0 : _a.id;
1334
+ const legacyOrderNumber = ((_d = (_c = (_b = this.order) === null || _b === void 0 ? void 0 : _b.references) === null || _c === void 0 ? void 0 : _c.find(entry => (entry === null || entry === void 0 ? void 0 : entry.key) === 'zonosOrderNumber')) === null || _d === void 0 ? void 0 : _d.value) || null;
1335
+ if (orderId) {
1336
+ queryParams.set('zOrderNumber', orderId);
1337
+ }
1338
+ if (legacyOrderNumber) {
1339
+ queryParams.set('orderId', legacyOrderNumber);
1340
+ }
1341
+ const queryString = queryParams.toString();
1342
+ const hasQueryString = redirectUrl.includes('?');
1343
+ this.isWaitingToRedirect = true;
1344
+ this.redirectToUrl(queryString
1345
+ ? // Some url already has query string, so we need to append the query string with '&' instead of '?'
1346
+ `${redirectUrl}${hasQueryString ? '&' : '?'}${queryString}`
1347
+ : redirectUrl);
1348
+ };
1327
1349
  this.handleSuccessBehavior = async () => {
1328
- var _a, _b;
1329
1350
  /**
1330
1351
  * Save placed order info so we can show order info if they try to place the order again
1331
1352
  */
@@ -1335,9 +1356,6 @@ const ZonosCheckoutFinish = class {
1335
1356
  // If the merchant wants to redirect to a different page
1336
1357
  case successBehavior === 'REDIRECT_TO_SUCCESS_PAGE':
1337
1358
  case !!cartStore.externalConfirmationPageURL: {
1338
- const settingsRedirectUrl = cartStore.externalConfirmationPageURL ||
1339
- zonosStore.checkoutSettings.successRedirectUrl;
1340
- const redirectUrl = settingsRedirectUrl;
1341
1359
  // use different default notification message if we are redirecting to a different page
1342
1360
  this.notificationTitle = translate('Order complete!');
1343
1361
  this.notificationMessages = [
@@ -1360,20 +1378,7 @@ const ZonosCheckoutFinish = class {
1360
1378
  return;
1361
1379
  }
1362
1380
  this.isWaitingToRedirect = false;
1363
- const legacyOrderNumber = ((_b = (_a = this.order.references) === null || _a === void 0 ? void 0 : _a.find(entry => (entry === null || entry === void 0 ? void 0 : entry.key) === 'zonosOrderNumber')) === null || _b === void 0 ? void 0 : _b.value) || null;
1364
- const queryParams = new URLSearchParams();
1365
- if (this.order.id) {
1366
- queryParams.set('zOrderNumber', this.order.id);
1367
- }
1368
- if (legacyOrderNumber) {
1369
- queryParams.set('orderId', legacyOrderNumber);
1370
- }
1371
- const queryString = queryParams.toString();
1372
- const hasQueryString = redirectUrl.includes('?');
1373
- this.redirectToUrl(queryString
1374
- ? // Some url already has query string, so we need to append the query string with '&' instead of '?'
1375
- `${redirectUrl}${hasQueryString ? '&' : '?'}${queryString}`
1376
- : redirectUrl);
1381
+ this.redirectToMerchantSuccessPage();
1377
1382
  break;
1378
1383
  }
1379
1384
  case successBehavior === 'CLOSE_MODAL':
@@ -1623,17 +1628,25 @@ const ZonosCheckoutFinish = class {
1623
1628
  }
1624
1629
  render() {
1625
1630
  const isTestMode = getIsTestMode();
1626
- return (h(Host, { key: '83b2f5f6f12dff3ed43382c27d1ed438ba22170f', class: "zonos--checkout-finish zonos--elements", style: {
1631
+ return (h(Host, { key: 'afcb0314658af4d53e7d453415dd73fb01a8f162', class: "zonos--checkout-finish zonos--elements", style: {
1627
1632
  '--zonos--border-radius': getBorderRadius({
1628
1633
  overrideBorderStyle: this.borderRadius,
1629
1634
  }),
1630
- } }, !this.isLoading && (h("div", { key: 'caba612654a4895ba6ef43781ca21688c17e32ea', class: "zonos--finish-details" }, h("div", { key: 'd18c28b4993f28a2d509b2a9178fed7edfe5de3d', class: "zonos--group" }, this.notificationType === 'success' ? (h("zonos-icon", { "aria-label": "Order success", content: SuccessIcon, iconColor: 'blue-800', size: 50 })) : (h("zonos-icon", { "aria-label": "Order failed", content: RemoveIcon, iconColor: 'red-800', size: 50 })), h("zonos-text", { key: 'af4f9f2178e83d8079950ad44a6b228976e761bc', class: "zonos--title", type: "semiBoldSubheader" }, this.notificationTitle), h("zonos-text", { key: 'cc4934a9c86c02d00d381b1d8e3a457ebf4759e3', class: "zonos--subtitle", textColor: "gray-600" }, this.notificationMessages.map(message => (h(Fragment, null, message, h("br", null))))), this.shouldRenderCloseButtonForRedirectBehavior() && (h("zonos-button", { key: 'c0f448d9f8fc30d5757714a041b440c48ed8a972',
1635
+ } }, !this.isLoading && (h("div", { key: '99b7b6c9dd0e0545d770e4d9ed54207f5c13fdfd', class: "zonos--finish-details" }, h("div", { key: '11d249514d0eef2f8419e66b1070a20e745b84fd', class: "zonos--group" }, this.notificationType === 'success' ? (h("zonos-icon", { "aria-label": "Order success", content: SuccessIcon, iconColor: 'blue-800', size: 50 })) : (h("zonos-icon", { "aria-label": "Order failed", content: RemoveIcon, iconColor: 'red-800', size: 50 })), h("zonos-text", { key: 'c8f52780e8ea76b5951aa4ad3dfc87c19acbfd1d', class: "zonos--title", type: "semiBoldSubheader" }, this.notificationTitle), h("zonos-text", { key: '459d7c1a9bd6fd77cfda25e9500a89061874b58f', class: "zonos--subtitle", textColor: "gray-600" }, this.notificationMessages.map(message => (h(Fragment, null, message, h("br", null))))), this.shouldRenderCloseButtonForRedirectBehavior() && (h("zonos-button", { key: '4e34926ba96975ceff18016eb6bcad1906f1c773',
1631
1636
  // Only show loading spinner if it's not an error notification
1632
1637
  loading: this.isWaitingToRedirect &&
1633
- this.notificationType !== 'error', onClick: () => this.closeClickHandler(), size: "md", variant: "primary" }, translate('Close'))), !window.Zonos.isLegacyCheckout &&
1634
- this.shouldRenderKeepShoppingButton() && (h("zonos-button", { key: '7cd94a0b56dbe608a4c3c9d12c9f9a4fc06c5ec3', onClick: () => this.closeClickHandler(), size: "md", variant: "primary" }, this.notificationActionText))), isTestMode &&
1638
+ this.notificationType !== 'error', onClick: () => {
1639
+ var _a;
1640
+ // Trigger the redirect action if order is ready when user clicks the close button
1641
+ if ((_a = this.order) === null || _a === void 0 ? void 0 : _a.id) {
1642
+ this.redirectToMerchantSuccessPage();
1643
+ return;
1644
+ }
1645
+ this.closeClickHandler();
1646
+ }, size: "md", variant: "primary" }, translate('Close'))), !window.Zonos.isLegacyCheckout &&
1647
+ this.shouldRenderKeepShoppingButton() && (h("zonos-button", { key: '836907a2a325d615d897e5292f086bf9111226ae', onClick: () => this.closeClickHandler(), size: "md", variant: "primary" }, this.notificationActionText))), isTestMode &&
1635
1648
  cartStore.step === 'finish' &&
1636
- this.notificationType === 'success' && (h("div", { key: 'ce7b437229ae19b2a2da2521f8603271ff35af96', class: "zonos--finish-button-wrapper" }, h("zonos-button", { key: '9ebb42bb862ffdf8c96c8e8d38174e149ced4d26', backgroundColor: "gray-0", buttonColor: "gray-1000", onClick: () => this.closeClickHandler(), size: "lg", variant: "outline" }, "New test cart"), h("zonos-button", { key: '6f9257ad1b3002a373b45ab498271825aea07a00', onClick: () => {
1649
+ this.notificationType === 'success' && (h("div", { key: 'ea1b4dd65f89d3eaec6391b6e440ae8ca20d5bdb', class: "zonos--finish-button-wrapper" }, h("zonos-button", { key: '350ee6b7fe58ff5e7a1584989e2df13ce5d243c6', backgroundColor: "gray-0", buttonColor: "gray-1000", onClick: () => this.closeClickHandler(), size: "lg", variant: "outline" }, "New test cart"), h("zonos-button", { key: 'd3578cef9a3f6cc69fff48ee412f7010d526c284', onClick: () => {
1637
1650
  const isZonosDashboard = window.location.hostname.includes('dashboard.zonos.com');
1638
1651
  this.redirectToUrl(isZonosDashboard
1639
1652
  ? '/orders/all'
@@ -587,7 +587,8 @@ const ZonosCheckout = class {
587
587
  this.placedOrderInfo = null;
588
588
  // Redirect to the vendor store url if this is legacy checkout
589
589
  if (this.isLegacyCheckout) {
590
- const storeBaseUrl = (_a = window.Zonos.cartData) === null || _a === void 0 ? void 0 : _a.storeBaseUrl;
590
+ const storeBaseUrl = ((_a = window.Zonos.cartData) === null || _a === void 0 ? void 0 : _a.storeBaseUrl) ||
591
+ zonosStore.onlineStoreSettings.url;
591
592
  if (!storeBaseUrl) {
592
593
  return;
593
594
  }
@@ -693,7 +694,8 @@ const ZonosCheckout = class {
693
694
  cartId: window.Zonos.cartId,
694
695
  checkoutSessionBody: getCheckoutSessionBody(),
695
696
  href: window.location.href,
696
- storeBaseUrl: (_a = window.Zonos.cartData) === null || _a === void 0 ? void 0 : _a.storeBaseUrl,
697
+ storeBaseUrl: ((_a = window.Zonos.cartData) === null || _a === void 0 ? void 0 : _a.storeBaseUrl) ||
698
+ zonosStore.onlineStoreSettings.url,
697
699
  },
698
700
  });
699
701
  cartStoreUpdateToErrorState({
@@ -1064,7 +1066,8 @@ const ZonosCheckout = class {
1064
1066
  cartStoreReset();
1065
1067
  // redirect to vendor store url if this is legacy checkout.
1066
1068
  if (window.Zonos.isLegacyCheckout && window.Zonos.cartData) {
1067
- const storeBaseUrl = window.Zonos.cartData.storeBaseUrl;
1069
+ const storeBaseUrl = window.Zonos.cartData.storeBaseUrl ||
1070
+ zonosStore.onlineStoreSettings.url;
1068
1071
  if (window.parent) {
1069
1072
  window.parent.location.href = storeBaseUrl;
1070
1073
  }
@@ -303,7 +303,8 @@ const ZonosController = class {
303
303
  successBehavior: shouldOverrideSuccessBehavior
304
304
  ? 'ZONOS_SUCCESS_PAGE'
305
305
  : this.config.checkoutSettings.successBehavior, successRedirectUrl: shouldOverrideSuccessBehavior
306
- ? (_e = window.Zonos.cartData) === null || _e === void 0 ? void 0 : _e.storeBaseUrl
306
+ ? ((_e = window.Zonos.cartData) === null || _e === void 0 ? void 0 : _e.storeBaseUrl) ||
307
+ (json === null || json === void 0 ? void 0 : json.onlineStoreSettings.url)
307
308
  : this.config.checkoutSettings.successRedirectUrl
308
309
  }) : undefined });
309
310
  // load default setting if failed to load user settings
@@ -395,7 +396,7 @@ const ZonosController = class {
395
396
  zonosStore.organizationName = organizationName;
396
397
  }
397
398
  render() {
398
- return h(Host, { key: 'd5d6c9e8984b321893b92612620a16f3f43d81fa', class: "zonos--elements" });
399
+ return h(Host, { key: '14d142f73eae70c229b638ef298e20c9c7c5713d', class: "zonos--elements" });
399
400
  }
400
401
  };
401
402
  ZonosController.style = ZonosControllerStyle0;